<template>
	<div>
		<ul class="mui-table-view">
			<li class="mui-table-view-cell mui-media" v-for="item in newslist" :key="item.id">
				<router-link :to="'/home/newsinfo/'+item.id">
					<img class="mui-media-object mui-pull-left" v-bind:src="item.img">
					<div class="mui-media-body">
						<h3>{{item.title}}</h3>
						<p class='mui-ellipsis'>
							<span>发表时间 :  {{item.pubdate | dateFormat}}</span>
							<span>点击：{{item.click}} 次</span>
						</p>
					</div>
				</router-link>
			</li>
		</ul>
	</div>
</template>

<script>
	export default {
		data(){
			return {
				newslist:[]
			}
		},
		created() {
			this.getNewsList();
		},
		methods:{
			getNewsList(){
				this.$http.get("../../data/newslist.json").then(function(data){
					var body = data.body;
					if(body.length>0){
						this.newslist = data.body;
					}else{
						this.newslist = [];
					}
					
				},function(err){
					console.log(err)
				})
			}
		}
	}
</script>

<style lang="scss" scoped="scoped">
	.mui-table-view{
		li{
			h3{
				font-size: 14px;
			}
			.mui-ellipsis{
				color: #226aff;
				font-size: 12px;
				display: flex;
				justify-content: space-between;
			}
		}
	}
</style>
